package com.skywork.utils;

import com.skywork.domain.Channel;

public class ChannelKit {

	private static final ThreadLocal<Channel> tl = new ThreadLocal<Channel>();
	
	private static boolean devMode = false;
	
	public static void setDevMode(boolean devMode) {
		ChannelKit.devMode = devMode;
	}
	
	public static boolean isDevMode() {
		return devMode;
	}
	
	public static void setThreadLocalChannel(Channel channel) {
		tl.set(channel);
	}
	
	public static void removeThreadLocal() {
		tl.remove();
	}
	
	public static Channel getChannel() {
		Channel channel = tl.get();
//		if (channel == null)
//			throw new IllegalStateException("需要事先使用 ApiConfigKit.setThreadLocalApiConfig(apiConfig) 将 ApiConfig对象存入，才可以调用 ApiConfigKit.getApiConfig() 方法");
		return channel;
	}
}
